<template>
  <div class="container">
    <CSuperForm v-bind="cDio" v-on="cDioMethods" />
    <Ctable v-bind="cTable" v-on="cTableMethods" />
  </div>
</template>
<script setup lang="ts">
import { intialFnFn, intialDataFn } from "@/components/CSuperForm/index";
let intialDataFnClass = new intialDataFn();
let cDiointialData: IntialDataType = {
  formType: "cDio",
  cformOpt: {
    saveUrl: "/admin/evaluation",
    items: {
      title: { type: "input", label: "量表名称" },
      introduce: { type: "input", label: "量表介绍" },
      guide: { type: "input", label: "量表引导" },
      type: { type: "select", label: "量表类型", values: [{ name: "1", id: 1 }], url: "/admin/evalType?page=0&size=100" },
      coverUrl: { type: "uImg", label: "标题", tip: "只能上传jpg/png文件，且不超过500kb" },
      enabled: {
        type: "radio",
        label: "是否使用",
        values: [
          { name: "是", id: "true" },
          { name: "否", id: "false" }
        ]
      }
    }
  },
  cDioOpt: { title: "新增量表" },
  formParams: { enabled: "true" }
};
let cDio = ref(intialDataFnClass.add(cDiointialData, "cDio"));
let cDiointialFn: intialFnType = {
  cDio: {
    commonFn: []
  }
};
let cDioMethods: any = ref({ cDio: {} });
let cTableintialData: IntialDataType = {
  cTableOpt: {
    list: { url: "/images" },
    delete: { url: "/images" },
    columns: [
      { label: "量表名称", prop: "title" },
      { label: "添加时间", prop: "createTime" }
    ]
  }
};
let cTable = ref(intialDataFnClass.add(cTableintialData, "cTable"));
let cTableintialFn: intialFnType = {
  cTable: { commonFn: [] }
};
let cTableMethods: any = ref({ cTable: {} });
onMounted(() => {
  cDioMethods.value = intialFnFn({ obj: intialDataFnClass.obj, intialFn: cDiointialFn });
  cTableMethods.value = intialFnFn({ obj: intialDataFnClass.obj, intialFn: cTableintialFn });
});
</script>
